/*
 * Created on Jun 12, 2004
 *
 * To change the template for this generated file go to
 * Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
 */
package mygui;

import java.awt.*;
import java.awt.event.ActionEvent;

import javax.swing.AbstractAction;

/**
 * @author Administrator
 *
 * To change the template for this generated type comment go to
 * Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
 */
public class ActionStop extends AbstractAction {

    private MonIHM _ihm;

    public ActionStop (MonIHM ihm){
	_ihm = ihm;

	putValue(AbstractAction.NAME,"Stop");
	putValue(AbstractAction.SHORT_DESCRIPTION,"Stop the simulation");
	//putValue(AbstractAction.ACCELERATOR_KEY,KeyStroke.getKeyStroke(KeyEvent.VK_SPACE,KeyEvent.CTRL_MASK));
	putValue(AbstractAction.SMALL_ICON,UIM.createImageIcon("images/stop.png","Stop"));
    }

    /* (non-Javadoc)
     * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
     */
    public void actionPerformed(ActionEvent arg0) {
	_ihm._kernel.stopSim();
	_ihm._display.setMode(DisplayPanel.Mode.ARROW);
	_ihm.updateCommandes();
	//_ihm.informationPane.updateInfos();
	_ihm._display.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
    }

}
